package com.yuyou.activity.group.service.mapper;

import com.yuyou.activity.group.service.vo.resp.RespActivityGroupBuyOrderListVo;
import com.yuyou.activity.group.service.vo.resp.RespActivityGroupBuyOrderVo;
import com.yuyou.activity.group.service.vo.resp.RespActivityGroupSPDetailUser;

import com.yuyou.activity.util.bean.Pagination;
import org.apache.ibatis.annotations.Mapper;

import com.yuyou.activity.group.service.entity.ActivityGroupbuyOrder;

import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface ActivityGroupbuyOrderMapper {
    int deleteByPrimaryKey(Long activityGroupbuyOrderId);

    int insert(ActivityGroupbuyOrder record);

    ActivityGroupbuyOrder selectByPrimaryKey(Long activityGroupbuyOrderId);

    int updateByPrimaryKeySelective(ActivityGroupbuyOrder record);


    List<ActivityGroupbuyOrder> findNotUpdateUser();

    void updateNoticeStatusByList(@Param(value = "list") List<ActivityGroupbuyOrder> list);

    void updateSynceStatusByList(@Param(value = "list") List<ActivityGroupbuyOrder> list);

    List<ActivityGroupbuyOrder> findByGroupId(@Param(value = "groupId")Long groupId);
    
    /**
     * 根据openId找出用户支付成功订单
     * @param openId
     * @return
     */
    List<ActivityGroupbuyOrder> findSuccByOpenId(String openId);
    
    ActivityGroupbuyOrder selectByOrderId(@Param(value = "projectCode")String projectCode,@Param(value = "orderId")String orderId);
    
    ActivityGroupbuyOrder selectByRefundId(@Param(value = "projectCode")String projectCode,@Param(value = "refundId")String refundId);

    List<RespActivityGroupSPDetailUser> selectUserListByGroupBugId(@Param(value = "projectCode")String projectCode, @Param(value = "activityGroupId")Long activityGroupId);

    String getChannelInOrder(@Param(value = "projectCode")String projectCode, @Param(value = "activityGroupId")Long activityGroupId,@Param(value = "openId")String openId);

    List<RespActivityGroupBuyOrderVo> myOrder(@Param(value = "projectCode")String projectCode,@Param(value = "openId")String openId);
    
    /**
     * 找出当前活动下成功支付的订单
     * @param activityGroupbuyId
     * @return
     */
    List<ActivityGroupbuyOrder> findSuccByGroupId(Long activityGroupbuyId);

    List<ActivityGroupbuyOrder> getNeedSyncOrder();

    void updateSyncById(@Param(value = "id")Long id , @Param(value = "isSync")Integer isSync);

    List<ActivityGroupbuyOrder> getAllNeedCheckOrder(@Param(value = "bigTime")Date bigTime , @Param(value = "smallTime")Date smallTime);


    Integer getAllUserOrderCount(Pagination<RespActivityGroupBuyOrderListVo> queryPgn);

    List<RespActivityGroupBuyOrderListVo> getAllUserOrder(Pagination<RespActivityGroupBuyOrderListVo> queryPgn);


    List<ActivityGroupbuyOrder> getOrderByOpenIdInGroup(@Param(value = "projectCode")String projectCode,@Param(value = "openId")String openId , @Param(value = "activityGroupbuyId")Long activityGroupbuyId);

}